/**
 * 
 */
package com.feonix.lambda;

import java.util.Arrays;
import java.util.List;

/**
 * @CopyRight (c)1993-2017
 * @Project common_practice
 * @Comments 给出一个String类型的数组，求其中所有不重复素数的和
 * @NameSpace com.feonix.lambda
 * @Author Feonixzw
 * @CreateDate 2017年12月27日
 */
public class DistinctPrimarySumTest {
	
	public static void distinctPrimarySum(String... numbers) {
        List<String> l = Arrays.asList(numbers);
        int sum = l.stream()
            .map(e -> new Integer(e))
            .filter(e -> Primes.isPrime(e))
            .distinct()
            .reduce(0, (x,y) -> x+y); // equivalent to .sum()
        System.out.println("distinctPrimarySum result is: " + sum);
    }

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		distinctPrimarySum("1", "2", "3", "4", "5", "6", "3");

	}

}
